This is an R Markdown Notebook. When you execute code within the notebook, the results appear beneath the code.

Try executing this chunk by clicking the Run button within the chunk or by placing your cursor inside it and pressing Cmd+Shift+Enter.

#set up path 
  knitr::opts_knit$set(root.dir = normalizePath("/Users/mishafaruki/Desktop/QBIO490/qbio_490_mishafaruki/analysis_data")) 
#import libraries 
library(BiocManager)
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.2 (2023-10-31)
library(TCGAbiolinks)
Registered S3 methods overwritten by 'dbplyr':
  method         from
  print.tbl_lazy     
  print.tbl_sql      
Registered S3 method overwritten by 'data.table':
  method           from
  print.data.table     
library(maftools)

#create a query based on the clinical category of TCGA-SKCM 
clin_query <- GDCquery(project = "TCGA-SKCM",
  data.category = "Clinical",
  data.type = "Clinical Supplement",
  data.format = 'BCR Biotab')
--------------------------------------
o GDCquery: Searching in GDC database
--------------------------------------
Genome of reference: hg38
--------------------------------------------
oo Accessing GDC. This might take a while...
--------------------------------------------
ooo Project: TCGA-SKCM
--------------------
oo Filtering results
--------------------
ooo By data.format
ooo By data.type
----------------
oo Checking data
----------------
ooo Checking if there are duplicated cases
Warning: There are more than one file for the same case. Please verify query results. You can use the command View(getResults(query)) in rstudio
ooo Checking if there are results for the query
-------------------
o Preparing output
-------------------
  GDCdownload(clin_query)
Downloading data for project TCGA-SKCM
Of the 6 files for download 6 already exist.
All samples have been already downloaded
  clinical.BCRtab.all <- GDCprepare(clin_query)

  |                                                                                                                      
  |                                                                                                                |   0%
New names:

  |                                                                                                                      
  |===================                                                                                             |  17%
  |                                                                                                                      
  |=====================================                                                                           |  33%
  |                                                                                                                      
  |========================================================                                                        |  50%
  |                                                                                                                      
  |===========================================================================                                     |  67%
  |                                                                                                                      
  |=============================================================================================                   |  83%
  |                                                                                                                      
  |================================================================================================================| 100%
#create a query based on the Transcriptome Profiling/RNA category of TCGA-SKCM 
rna_query <- GDCquery(project ="TCGA-SKCM",
                      data.category = "Transcriptome Profiling",
                      data.type = "Gene Expression Quantification",
                      workflow.type = "STAR - Counts")
--------------------------------------
o GDCquery: Searching in GDC database
--------------------------------------
Genome of reference: hg38
--------------------------------------------
oo Accessing GDC. This might take a while...
--------------------------------------------
ooo Project: TCGA-SKCM
--------------------
oo Filtering results
--------------------
ooo By data.type
ooo By workflow.type
----------------
oo Checking data
----------------
ooo Checking if there are duplicated cases
ooo Checking if there are results for the query
-------------------
o Preparing output
-------------------
GDCdownload(rna_query)
Downloading data for project TCGA-SKCM
Of the 473 files for download 473 already exist.
All samples have been already downloaded
rna_se <- GDCprepare(rna_query)

|                                                                                              |  0%                      
|                                                                                              |0.2114165% ~30 s remaining
|                                                                                              |0.422833% ~25 s remaining 
|                                                                                              |0.6342495% ~24 s remaining
|                                                                                              |0.845666% ~24 s remaining 
|                                                                                              |1.057082% ~24 s remaining 
|=                                                                                             |1.268499% ~23 s remaining 
|=                                                                                             |1.479915% ~23 s remaining 
|=                                                                                             |1.691332% ~23 s remaining 
|=                                                                                             |1.902748% ~23 s remaining 
|=                                                                                             |2.114165% ~23 s remaining 
|==                                                                                            |2.325581% ~23 s remaining 
|==                                                                                            |2.536998% ~23 s remaining 
|==                                                                                            |2.748414% ~23 s remaining 
|==                                                                                            |2.959831% ~23 s remaining 
|==                                                                                            |3.171247% ~23 s remaining 
|===                                                                                           |3.382664% ~23 s remaining 
|===                                                                                           |3.59408% ~23 s remaining  
|===                                                                                           |3.805497% ~23 s remaining 
|===                                                                                           |4.016913% ~23 s remaining 
|===                                                                                           |4.22833% ~23 s remaining  
|====                                                                                          |4.439746% ~23 s remaining 
|====                                                                                          |4.651163% ~23 s remaining 
|====                                                                                          |4.862579% ~24 s remaining 
|====                                                                                          |5.073996% ~24 s remaining 
|====                                                                                          |5.285412% ~24 s remaining 
|=====                                                                                         |5.496829% ~24 s remaining 
|=====                                                                                         |5.708245% ~24 s remaining 
|=====                                                                                         |5.919662% ~24 s remaining 
|=====                                                                                         |6.131078% ~24 s remaining 
|=====                                                                                         |6.342495% ~24 s remaining 
|======                                                                                        |6.553911% ~24 s remaining 
|======                                                                                        |6.765328% ~24 s remaining 
|======                                                                                        |6.976744% ~24 s remaining 
|======                                                                                        |7.188161% ~24 s remaining 
|======                                                                                        |7.399577% ~24 s remaining 
|=======                                                                                       |7.610994% ~24 s remaining 
|=======                                                                                       |7.82241% ~24 s remaining  
|=======                                                                                       |8.033827% ~24 s remaining 
|=======                                                                                       |8.245243% ~24 s remaining 
|=======                                                                                       |8.45666% ~24 s remaining  
|========                                                                                      |8.668076% ~24 s remaining 
|========                                                                                      |8.879493% ~24 s remaining 
|========                                                                                      |9.090909% ~24 s remaining 
|========                                                                                      |9.302326% ~24 s remaining 
|========                                                                                      |9.513742% ~24 s remaining 
|=========                                                                                     |9.725159% ~24 s remaining 
|=========                                                                                     |9.936575% ~24 s remaining 
|=========                                                                                     |10.14799% ~24 s remaining 
|=========                                                                                     |10.35941% ~24 s remaining 
|=========                                                                                     |10.57082% ~24 s remaining 
|==========                                                                                    |10.78224% ~24 s remaining 
|==========                                                                                    |10.99366% ~24 s remaining 
|==========                                                                                    |11.20507% ~24 s remaining 
|==========                                                                                    |11.41649% ~23 s remaining 
|==========                                                                                    |11.62791% ~23 s remaining 
|===========                                                                                   |11.83932% ~23 s remaining 
|===========                                                                                   |12.05074% ~23 s remaining 
|===========                                                                                   |12.26216% ~23 s remaining 
|===========                                                                                   |12.47357% ~23 s remaining 
|===========                                                                                   |12.68499% ~23 s remaining 
|============                                                                                  |12.89641% ~23 s remaining 
|============                                                                                  |13.10782% ~23 s remaining 
|============                                                                                  |13.31924% ~23 s remaining 
|============                                                                                  |13.53066% ~23 s remaining 
|============                                                                                  |13.74207% ~23 s remaining 
|=============                                                                                 |13.95349% ~23 s remaining 
|=============                                                                                 |14.1649% ~23 s remaining  
|=============                                                                                 |14.37632% ~23 s remaining 
|=============                                                                                 |14.58774% ~23 s remaining 
|=============                                                                                 |14.79915% ~23 s remaining 
|==============                                                                                |15.01057% ~22 s remaining 
|==============                                                                                |15.22199% ~22 s remaining 
|==============                                                                                |15.4334% ~22 s remaining  
|==============                                                                                |15.64482% ~22 s remaining 
|==============                                                                                |15.85624% ~22 s remaining 
|===============                                                                               |16.06765% ~22 s remaining 
|===============                                                                               |16.27907% ~22 s remaining 
|===============                                                                               |16.49049% ~22 s remaining 
|===============                                                                               |16.7019% ~22 s remaining  
|===============                                                                               |16.91332% ~22 s remaining 
|================                                                                              |17.12474% ~22 s remaining 
|================                                                                              |17.33615% ~22 s remaining 
|================                                                                              |17.54757% ~22 s remaining 
|================                                                                              |17.75899% ~22 s remaining 
|================                                                                              |17.9704% ~21 s remaining  
|=================                                                                             |18.18182% ~21 s remaining 
|=================                                                                             |18.39323% ~21 s remaining 
|=================                                                                             |18.60465% ~21 s remaining 
|=================                                                                             |18.81607% ~21 s remaining 
|=================                                                                             |19.02748% ~21 s remaining 
|==================                                                                            |19.2389% ~21 s remaining  
|==================                                                                            |19.45032% ~21 s remaining 
|==================                                                                            |19.66173% ~21 s remaining 
|==================                                                                            |19.87315% ~21 s remaining 
|==================                                                                            |20.08457% ~21 s remaining 
|===================                                                                           |20.29598% ~21 s remaining 
|===================                                                                           |20.5074% ~21 s remaining  
|===================                                                                           |20.71882% ~21 s remaining 
|===================                                                                           |20.93023% ~21 s remaining 
|===================                                                                           |21.14165% ~21 s remaining 
|====================                                                                          |21.35307% ~21 s remaining 
|====================                                                                          |21.56448% ~21 s remaining 
|====================                                                                          |21.7759% ~21 s remaining  
|====================                                                                          |21.98732% ~21 s remaining 
|====================                                                                          |22.19873% ~21 s remaining 
|=====================                                                                         |22.41015% ~21 s remaining 
|=====================                                                                         |22.62156% ~21 s remaining 
|=====================                                                                         |22.83298% ~21 s remaining 
|=====================                                                                         |23.0444% ~21 s remaining  
|=====================                                                                         |23.25581% ~21 s remaining 
|======================                                                                        |23.46723% ~21 s remaining 
|======================                                                                        |23.67865% ~21 s remaining 
|======================                                                                        |23.89006% ~21 s remaining 
|======================                                                                        |24.10148% ~21 s remaining 
|======================                                                                        |24.3129% ~22 s remaining  
|=======================                                                                       |24.52431% ~22 s remaining 
|=======================                                                                       |24.73573% ~22 s remaining 
|=======================                                                                       |24.94715% ~22 s remaining 
|=======================                                                                       |25.15856% ~22 s remaining 
|=======================                                                                       |25.36998% ~22 s remaining 
|========================                                                                      |25.5814% ~22 s remaining  
|========================                                                                      |25.79281% ~22 s remaining 
|========================                                                                      |26.00423% ~24 s remaining 
|========================                                                                      |26.21564% ~24 s remaining 
|========================                                                                      |26.42706% ~24 s remaining 
|=========================                                                                     |26.63848% ~24 s remaining 
|=========================                                                                     |26.84989% ~24 s remaining 
|=========================                                                                     |27.06131% ~24 s remaining 
|=========================                                                                     |27.27273% ~24 s remaining 
|=========================                                                                     |27.48414% ~24 s remaining 
|==========================                                                                    |27.69556% ~24 s remaining 
|==========================                                                                    |27.90698% ~24 s remaining 
|==========================                                                                    |28.11839% ~24 s remaining 
|==========================                                                                    |28.32981% ~24 s remaining 
|==========================                                                                    |28.54123% ~24 s remaining 
|===========================                                                                   |28.75264% ~24 s remaining 
|===========================                                                                   |28.96406% ~24 s remaining 
|===========================                                                                   |29.17548% ~24 s remaining 
|===========================                                                                   |29.38689% ~24 s remaining 
|===========================                                                                   |29.59831% ~24 s remaining 
|============================                                                                  |29.80973% ~24 s remaining 
|============================                                                                  |30.02114% ~24 s remaining 
|============================                                                                  |30.23256% ~24 s remaining 
|============================                                                                  |30.44397% ~23 s remaining 
|============================                                                                  |30.65539% ~23 s remaining 
|=============================                                                                 |30.86681% ~23 s remaining 
|=============================                                                                 |31.07822% ~23 s remaining 
|=============================                                                                 |31.28964% ~23 s remaining 
|=============================                                                                 |31.50106% ~23 s remaining 
|=============================                                                                 |31.71247% ~23 s remaining 
|==============================                                                                |31.92389% ~23 s remaining 
|==============================                                                                |32.13531% ~23 s remaining 
|==============================                                                                |32.34672% ~23 s remaining 
|==============================                                                                |32.55814% ~22 s remaining 
|==============================                                                                |32.76956% ~22 s remaining 
|===============================                                                               |32.98097% ~22 s remaining 
|===============================                                                               |33.19239% ~22 s remaining 
|===============================                                                               |33.40381% ~22 s remaining 
|===============================                                                               |33.61522% ~22 s remaining 
|===============================                                                               |33.82664% ~22 s remaining 
|===============================                                                               |34.03805% ~22 s remaining 
|================================                                                              |34.24947% ~22 s remaining 
|================================                                                              |34.46089% ~22 s remaining 
|================================                                                              |34.6723% ~22 s remaining  
|================================                                                              |34.88372% ~21 s remaining 
|================================                                                              |35.09514% ~21 s remaining 
|=================================                                                             |35.30655% ~21 s remaining 
|=================================                                                             |35.51797% ~21 s remaining 
|=================================                                                             |35.72939% ~21 s remaining 
|=================================                                                             |35.9408% ~21 s remaining  
|=================================                                                             |36.15222% ~21 s remaining 
|==================================                                                            |36.36364% ~21 s remaining 
|==================================                                                            |36.57505% ~21 s remaining 
|==================================                                                            |36.78647% ~21 s remaining 
|==================================                                                            |36.99789% ~21 s remaining 
|==================================                                                            |37.2093% ~20 s remaining  
|===================================                                                           |37.42072% ~20 s remaining 
|===================================                                                           |37.63214% ~20 s remaining 
|===================================                                                           |37.84355% ~20 s remaining 
|===================================                                                           |38.05497% ~20 s remaining 
|===================================                                                           |38.26638% ~20 s remaining 
|====================================                                                          |38.4778% ~20 s remaining  
|====================================                                                          |38.68922% ~20 s remaining 
|====================================                                                          |38.90063% ~20 s remaining 
|====================================                                                          |39.11205% ~20 s remaining 
|====================================                                                          |39.32347% ~20 s remaining 
|=====================================                                                         |39.53488% ~20 s remaining 
|=====================================                                                         |39.7463% ~19 s remaining  
|=====================================                                                         |39.95772% ~19 s remaining 
|=====================================                                                         |40.16913% ~19 s remaining 
|=====================================                                                         |40.38055% ~19 s remaining 
|======================================                                                        |40.59197% ~19 s remaining 
|======================================                                                        |40.80338% ~19 s remaining 
|======================================                                                        |41.0148% ~19 s remaining  
|======================================                                                        |41.22622% ~19 s remaining 
|======================================                                                        |41.43763% ~19 s remaining 
|=======================================                                                       |41.64905% ~19 s remaining 
|=======================================                                                       |41.86047% ~19 s remaining 
|=======================================                                                       |42.07188% ~18 s remaining 
|=======================================                                                       |42.2833% ~18 s remaining  
|=======================================                                                       |42.49471% ~18 s remaining 
|========================================                                                      |42.70613% ~18 s remaining 
|========================================                                                      |42.91755% ~18 s remaining 
|========================================                                                      |43.12896% ~18 s remaining 
|========================================                                                      |43.34038% ~18 s remaining 
|========================================                                                      |43.5518% ~18 s remaining  
|=========================================                                                     |43.76321% ~19 s remaining 
|=========================================                                                     |43.97463% ~19 s remaining 
|=========================================                                                     |44.18605% ~19 s remaining 
|=========================================                                                     |44.39746% ~19 s remaining 
|=========================================                                                     |44.60888% ~18 s remaining 
|==========================================                                                    |44.8203% ~18 s remaining  
|==========================================                                                    |45.03171% ~18 s remaining 
|==========================================                                                    |45.24313% ~18 s remaining 
|==========================================                                                    |45.45455% ~18 s remaining 
|==========================================                                                    |45.66596% ~18 s remaining 
|===========================================                                                   |45.87738% ~18 s remaining 
|===========================================                                                   |46.08879% ~18 s remaining 
|===========================================                                                   |46.30021% ~18 s remaining 
|===========================================                                                   |46.51163% ~18 s remaining 
|===========================================                                                   |46.72304% ~18 s remaining 
|============================================                                                  |46.93446% ~18 s remaining 
|============================================                                                  |47.14588% ~17 s remaining 
|============================================                                                  |47.35729% ~17 s remaining 
|============================================                                                  |47.56871% ~17 s remaining 
|============================================                                                  |47.78013% ~17 s remaining 
|=============================================                                                 |47.99154% ~17 s remaining 
|=============================================                                                 |48.20296% ~17 s remaining 
|=============================================                                                 |48.41438% ~17 s remaining 
|=============================================                                                 |48.62579% ~17 s remaining 
|=============================================                                                 |48.83721% ~17 s remaining 
|==============================================                                                |49.04863% ~17 s remaining 
|==============================================                                                |49.26004% ~17 s remaining 
|==============================================                                                |49.47146% ~17 s remaining 
|==============================================                                                |49.68288% ~16 s remaining 
|==============================================                                                |49.89429% ~16 s remaining 
|===============================================                                               |50.10571% ~16 s remaining 
|===============================================                                               |50.31712% ~16 s remaining 
|===============================================                                               |50.52854% ~16 s remaining 
|===============================================                                               |50.73996% ~16 s remaining 
|===============================================                                               |50.95137% ~16 s remaining 
|================================================                                              |51.16279% ~16 s remaining 
|================================================                                              |51.37421% ~16 s remaining 
|================================================                                              |51.58562% ~16 s remaining 
|================================================                                              |51.79704% ~16 s remaining 
|================================================                                              |52.00846% ~16 s remaining 
|=================================================                                             |52.21987% ~16 s remaining 
|=================================================                                             |52.43129% ~15 s remaining 
|=================================================                                             |52.64271% ~15 s remaining 
|=================================================                                             |52.85412% ~15 s remaining 
|=================================================                                             |53.06554% ~15 s remaining 
|==================================================                                            |53.27696% ~15 s remaining 
|==================================================                                            |53.48837% ~15 s remaining 
|==================================================                                            |53.69979% ~15 s remaining 
|==================================================                                            |53.91121% ~15 s remaining 
|==================================================                                            |54.12262% ~15 s remaining 
|===================================================                                           |54.33404% ~15 s remaining 
|===================================================                                           |54.54545% ~15 s remaining 
|===================================================                                           |54.75687% ~15 s remaining 
|===================================================                                           |54.96829% ~15 s remaining 
|===================================================                                           |55.1797% ~14 s remaining  
|====================================================                                          |55.39112% ~14 s remaining 
|====================================================                                          |55.60254% ~14 s remaining 
|====================================================                                          |55.81395% ~14 s remaining 
|====================================================                                          |56.02537% ~14 s remaining 
|====================================================                                          |56.23679% ~14 s remaining 
|=====================================================                                         |56.4482% ~14 s remaining  
|=====================================================                                         |56.65962% ~14 s remaining 
|=====================================================                                         |56.87104% ~14 s remaining 
|=====================================================                                         |57.08245% ~14 s remaining 
|=====================================================                                         |57.29387% ~14 s remaining 
|======================================================                                        |57.50529% ~14 s remaining 
|======================================================                                        |57.7167% ~14 s remaining  
|======================================================                                        |57.92812% ~14 s remaining 
|======================================================                                        |58.13953% ~13 s remaining 
|======================================================                                        |58.35095% ~13 s remaining 
|=======================================================                                       |58.56237% ~13 s remaining 
|=======================================================                                       |58.77378% ~13 s remaining 
|=======================================================                                       |58.9852% ~13 s remaining  
|=======================================================                                       |59.19662% ~13 s remaining 
|=======================================================                                       |59.40803% ~13 s remaining 
|========================================================                                      |59.61945% ~13 s remaining 
|========================================================                                      |59.83087% ~13 s remaining 
|========================================================                                      |60.04228% ~13 s remaining 
|========================================================                                      |60.2537% ~13 s remaining  
|========================================================                                      |60.46512% ~13 s remaining 
|=========================================================                                     |60.67653% ~13 s remaining 
|=========================================================                                     |60.88795% ~13 s remaining 
|=========================================================                                     |61.09937% ~12 s remaining 
|=========================================================                                     |61.31078% ~12 s remaining 
|=========================================================                                     |61.5222% ~12 s remaining  
|==========================================================                                    |61.73362% ~12 s remaining 
|==========================================================                                    |61.94503% ~12 s remaining 
|==========================================================                                    |62.15645% ~12 s remaining 
|==========================================================                                    |62.36786% ~12 s remaining 
|==========================================================                                    |62.57928% ~12 s remaining 
|===========================================================                                   |62.7907% ~12 s remaining  
|===========================================================                                   |63.00211% ~12 s remaining 
|===========================================================                                   |63.21353% ~12 s remaining 
|===========================================================                                   |63.42495% ~12 s remaining 
|===========================================================                                   |63.63636% ~12 s remaining 
|============================================================                                  |63.84778% ~12 s remaining 
|============================================================                                  |64.0592% ~11 s remaining  
|============================================================                                  |64.27061% ~11 s remaining 
|============================================================                                  |64.48203% ~11 s remaining 
|============================================================                                  |64.69345% ~11 s remaining 
|=============================================================                                 |64.90486% ~12 s remaining 
|=============================================================                                 |65.11628% ~12 s remaining 
|=============================================================                                 |65.3277% ~12 s remaining  
|=============================================================                                 |65.53911% ~11 s remaining 
|=============================================================                                 |65.75053% ~11 s remaining 
|==============================================================                                |65.96195% ~11 s remaining 
|==============================================================                                |66.17336% ~11 s remaining 
|==============================================================                                |66.38478% ~11 s remaining 
|==============================================================                                |66.59619% ~11 s remaining 
|==============================================================                                |66.80761% ~11 s remaining 
|==============================================================                                |67.01903% ~11 s remaining 
|===============================================================                               |67.23044% ~11 s remaining 
|===============================================================                               |67.44186% ~11 s remaining 
|===============================================================                               |67.65328% ~11 s remaining 
|===============================================================                               |67.86469% ~11 s remaining 
|===============================================================                               |68.07611% ~11 s remaining 
|================================================================                              |68.28753% ~11 s remaining 
|================================================================                              |68.49894% ~10 s remaining 
|================================================================                              |68.71036% ~10 s remaining 
|================================================================                              |68.92178% ~10 s remaining 
|================================================================                              |69.13319% ~10 s remaining 
|=================================================================                             |69.34461% ~10 s remaining 
|=================================================================                             |69.55603% ~10 s remaining 
|=================================================================                             |69.76744% ~10 s remaining 
|=================================================================                             |69.97886% ~10 s remaining 
|=================================================================                             |70.19027% ~10 s remaining 
|==================================================================                            |70.40169% ~10 s remaining 
|==================================================================                            |70.61311% ~10 s remaining 
|==================================================================                            |70.82452% ~10 s remaining 
|==================================================================                            |71.03594% ~10 s remaining 
|==================================================================                            |71.24736% ~9 s remaining  
|===================================================================                           |71.45877% ~9 s remaining  
|===================================================================                           |71.67019% ~9 s remaining  
|===================================================================                           |71.88161% ~9 s remaining  
|===================================================================                           |72.09302% ~9 s remaining  
|===================================================================                           |72.30444% ~9 s remaining  
|====================================================================                          |72.51586% ~9 s remaining  
|====================================================================                          |72.72727% ~9 s remaining  
|====================================================================                          |72.93869% ~9 s remaining  
|====================================================================                          |73.15011% ~9 s remaining  
|====================================================================                          |73.36152% ~9 s remaining  
|=====================================================================                         |73.57294% ~9 s remaining  
|=====================================================================                         |73.78436% ~9 s remaining  
|=====================================================================                         |73.99577% ~8 s remaining  
|=====================================================================                         |74.20719% ~8 s remaining  
|=====================================================================                         |74.4186% ~8 s remaining   
|======================================================================                        |74.63002% ~8 s remaining  
|======================================================================                        |74.84144% ~8 s remaining  
|======================================================================                        |75.05285% ~8 s remaining  
|======================================================================                        |75.26427% ~8 s remaining  
|======================================================================                        |75.47569% ~8 s remaining  
|=======================================================================                       |75.6871% ~8 s remaining   
|=======================================================================                       |75.89852% ~8 s remaining  
|=======================================================================                       |76.10994% ~8 s remaining  
|=======================================================================                       |76.32135% ~8 s remaining  
|=======================================================================                       |76.53277% ~8 s remaining  
|========================================================================                      |76.74419% ~8 s remaining  
|========================================================================                      |76.9556% ~7 s remaining   
|========================================================================                      |77.16702% ~7 s remaining  
|========================================================================                      |77.37844% ~7 s remaining  
|========================================================================                      |77.58985% ~7 s remaining  
|=========================================================================                     |77.80127% ~7 s remaining  
|=========================================================================                     |78.01268% ~7 s remaining  
|=========================================================================                     |78.2241% ~7 s remaining   
|=========================================================================                     |78.43552% ~7 s remaining  
|=========================================================================                     |78.64693% ~7 s remaining  
|==========================================================================                    |78.85835% ~7 s remaining  
|==========================================================================                    |79.06977% ~7 s remaining  
|==========================================================================                    |79.28118% ~7 s remaining  
|==========================================================================                    |79.4926% ~7 s remaining   
|==========================================================================                    |79.70402% ~7 s remaining  
|===========================================================================                   |79.91543% ~6 s remaining  
|===========================================================================                   |80.12685% ~6 s remaining  
|===========================================================================                   |80.33827% ~6 s remaining  
|===========================================================================                   |80.54968% ~6 s remaining  
|===========================================================================                   |80.7611% ~6 s remaining   
|============================================================================                  |80.97252% ~6 s remaining  
|============================================================================                  |81.18393% ~6 s remaining  
|============================================================================                  |81.39535% ~6 s remaining  
|============================================================================                  |81.60677% ~6 s remaining  
|============================================================================                  |81.81818% ~6 s remaining  
|=============================================================================                 |82.0296% ~6 s remaining   
|=============================================================================                 |82.24101% ~6 s remaining  
|=============================================================================                 |82.45243% ~6 s remaining  
|=============================================================================                 |82.66385% ~6 s remaining  
|=============================================================================                 |82.87526% ~5 s remaining  
|==============================================================================                |83.08668% ~5 s remaining  
|==============================================================================                |83.2981% ~5 s remaining   
|==============================================================================                |83.50951% ~5 s remaining  
|==============================================================================                |83.72093% ~5 s remaining  
|==============================================================================                |83.93235% ~5 s remaining  
|===============================================================================               |84.14376% ~5 s remaining  
|===============================================================================               |84.35518% ~5 s remaining  
|===============================================================================               |84.5666% ~5 s remaining   
|===============================================================================               |84.77801% ~5 s remaining  
|===============================================================================               |84.98943% ~5 s remaining  
|================================================================================              |85.20085% ~5 s remaining  
|================================================================================              |85.41226% ~5 s remaining  
|================================================================================              |85.62368% ~5 s remaining  
|================================================================================              |85.8351% ~4 s remaining   
|================================================================================              |86.04651% ~4 s remaining  
|=================================================================================             |86.25793% ~4 s remaining  
|=================================================================================             |86.46934% ~4 s remaining  
|=================================================================================             |86.68076% ~4 s remaining  
|=================================================================================             |86.89218% ~4 s remaining  
|=================================================================================             |87.10359% ~4 s remaining  
|==================================================================================            |87.31501% ~4 s remaining  
|==================================================================================            |87.52643% ~4 s remaining  
|==================================================================================            |87.73784% ~4 s remaining  
|==================================================================================            |87.94926% ~4 s remaining  
|==================================================================================            |88.16068% ~4 s remaining  
|===================================================================================           |88.37209% ~4 s remaining  
|===================================================================================           |88.58351% ~4 s remaining  
|===================================================================================           |88.79493% ~4 s remaining  
|===================================================================================           |89.00634% ~3 s remaining  
|===================================================================================           |89.21776% ~3 s remaining  
|====================================================================================          |89.42918% ~3 s remaining  
|====================================================================================          |89.64059% ~3 s remaining  
|====================================================================================          |89.85201% ~3 s remaining  
|====================================================================================          |90.06342% ~3 s remaining  
|====================================================================================          |90.27484% ~3 s remaining  
|=====================================================================================         |90.48626% ~3 s remaining  
|=====================================================================================         |90.69767% ~3 s remaining  
|=====================================================================================         |90.90909% ~3 s remaining  
|=====================================================================================         |91.12051% ~3 s remaining  
|=====================================================================================         |91.33192% ~3 s remaining  
|======================================================================================        |91.54334% ~3 s remaining  
|======================================================================================        |91.75476% ~3 s remaining  
|======================================================================================        |91.96617% ~3 s remaining  
|======================================================================================        |92.17759% ~3 s remaining  
|======================================================================================        |92.38901% ~3 s remaining  
|=======================================================================================       |92.60042% ~2 s remaining  
|=======================================================================================       |92.81184% ~2 s remaining  
|=======================================================================================       |93.02326% ~2 s remaining  
|=======================================================================================       |93.23467% ~2 s remaining  
|=======================================================================================       |93.44609% ~2 s remaining  
|========================================================================================      |93.65751% ~2 s remaining  
|========================================================================================      |93.86892% ~2 s remaining  
|========================================================================================      |94.08034% ~2 s remaining  
|========================================================================================      |94.29175% ~2 s remaining  
|========================================================================================      |94.50317% ~2 s remaining  
|=========================================================================================     |94.71459% ~2 s remaining  
|=========================================================================================     |94.926% ~2 s remaining    
|=========================================================================================     |95.13742% ~2 s remaining  
|=========================================================================================     |95.34884% ~2 s remaining  
|=========================================================================================     |95.56025% ~1 s remaining  
|==========================================================================================    |95.77167% ~1 s remaining  
|==========================================================================================    |95.98309% ~1 s remaining  
|==========================================================================================    |96.1945% ~1 s remaining   
|==========================================================================================    |96.40592% ~1 s remaining  
|==========================================================================================    |96.61734% ~1 s remaining  
|===========================================================================================   |96.82875% ~1 s remaining  
|===========================================================================================   |97.04017% ~1 s remaining  
|===========================================================================================   |97.25159% ~1 s remaining  
|===========================================================================================   |97.463% ~1 s remaining    
|===========================================================================================   |97.67442% ~1 s remaining  
|============================================================================================  |97.88584% ~1 s remaining  
|============================================================================================  |98.09725% ~1 s remaining  
|============================================================================================  |98.30867% ~1 s remaining  
|============================================================================================  |98.52008% ~0 s remaining  
|============================================================================================  |98.7315% ~0 s remaining   
|============================================================================================= |98.94292% ~0 s remaining  
|============================================================================================= |99.15433% ~0 s remaining  
|============================================================================================= |99.36575% ~0 s remaining  
|============================================================================================= |99.57717% ~0 s remaining  
|============================================================================================= |99.78858% ~0 s remaining  
|==============================================================================================|100% ~0 s remaining       
|==============================================================================================|100%                      Completed after 33 s 
Starting to add information to samples
 => Add clinical information to samples
 => Adding TCGA molecular information from marker papers
 => Information will have prefix 'paper_' 
skcm subtype information from:doi:10.1016/j.cell.2015.05.044
Available assays in SummarizedExperiment : 
  => unstranded
  => stranded_first
  => stranded_second
  => tpm_unstrand
  => fpkm_unstrand
  => fpkm_uq_unstrand
  1. Difference in survival between metastatic and non-metastatic patients (KM plot)
# load required packages for KM plot 
if (!require(survival)) {
  install.packages("survival")
}

if (!require(survminer)) {
  install.packages("survminer")
}

if (!require(ggplot2)) {
  install.packages("ggplot2")
}

library(survival)
library(survminer)
library(ggplot2)

#create rna clinical that will contain data from colData
rna_clinical = rna_se@colData
#convert it to a dataframe 
rna_clinical <- as.data.frame(rna_clinical)
#Set output to Tumor_Sample_Barcode in rna_clincal so that it derived from patient category 
rna_clinical$Tumor_Sample_Barcode <- rna_clinical$patient

#Set output to vital_status_num have to contain vital_status colum's data but make the values numeric 
rna_clinical$vital_status_num <- as.numeric(rna_clinical$vital_status == "Dead")

#Create Survminer Object
#contains the survival data 
survival_object <- Surv(time = rna_clinical$days_to_death, event = rna_clinical$vital_status_num)
#fit survival_object curve 
fit <- survfit(surv_obj ~ rna_clinical$definition, data = rna_clinical)

#create KM plot 
ggsurvplot(fit, data = rna_clinical, pval = TRUE, 
           risk.table = TRUE, #risk table
           legend.title = "Metastatic Status",
           xlab = "Time", ylab = "Survival probability",
           break.time.by = 1000, # adjusting time intervals
           risk.table.col = "strata") # color risk table

  1. Mutation differences between metastatic and non-metastatic patients for multiple genes in a Co-oncoplot.
#access the drug and radiation dataframes
rad <- clinical.BCRtab.all$clinical_radiation_skcm[-c(1,2),]
drug <- clinical.BCRtab.all$clinical_drug_skcm[-c(1,2),]
#packages
library(maftools)
#instantiate object
rna_query <- GDCquery(project ="TCGA-SKCM",
                      data.category = "Transcriptome Profiling",
                      data.type = "Gene Expression Quantification",
                      workflow.type = "STAR - Counts")
--------------------------------------
o GDCquery: Searching in GDC database
--------------------------------------
Genome of reference: hg38
--------------------------------------------
oo Accessing GDC. This might take a while...
--------------------------------------------
ooo Project: TCGA-SKCM
--------------------
oo Filtering results
--------------------
ooo By data.type
ooo By workflow.type
----------------
oo Checking data
----------------
ooo Checking if there are duplicated cases
ooo Checking if there are results for the query
-------------------
o Preparing output
-------------------
GDCdownload(rna_query)
Downloading data for project TCGA-SKCM
Of the 473 files for download 473 already exist.
All samples have been already downloaded
rna_se <- GDCprepare(rna_query)

|                                                                                              |  0%                      
|                                                                                              |0.2114165% ~37 s remaining
|                                                                                              |0.422833% ~33 s remaining 
|                                                                                              |0.6342495% ~33 s remaining
|                                                                                              |0.845666% ~32 s remaining 
|                                                                                              |1.057082% ~32 s remaining 
|=                                                                                             |1.268499% ~32 s remaining 
|=                                                                                             |1.479915% ~31 s remaining 
|=                                                                                             |1.691332% ~31 s remaining 
|=                                                                                             |1.902748% ~30 s remaining 
|=                                                                                             |2.114165% ~30 s remaining 
|==                                                                                            |2.325581% ~30 s remaining 
|==                                                                                            |2.536998% ~30 s remaining 
|==                                                                                            |2.748414% ~29 s remaining 
|==                                                                                            |2.959831% ~29 s remaining 
|==                                                                                            |3.171247% ~28 s remaining 
|===                                                                                           |3.382664% ~28 s remaining 
|===                                                                                           |3.59408% ~28 s remaining  
|===                                                                                           |3.805497% ~27 s remaining 
|===                                                                                           |4.016913% ~27 s remaining 
|===                                                                                           |4.22833% ~27 s remaining  
|====                                                                                          |4.439746% ~27 s remaining 
|====                                                                                          |4.651163% ~27 s remaining 
|====                                                                                          |4.862579% ~26 s remaining 
|====                                                                                          |5.073996% ~26 s remaining 
|====                                                                                          |5.285412% ~26 s remaining 
|=====                                                                                         |5.496829% ~26 s remaining 
|=====                                                                                         |5.708245% ~26 s remaining 
|=====                                                                                         |5.919662% ~26 s remaining 
|=====                                                                                         |6.131078% ~27 s remaining 
|=====                                                                                         |6.342495% ~27 s remaining 
|======                                                                                        |6.553911% ~27 s remaining 
|======                                                                                        |6.765328% ~27 s remaining 
|======                                                                                        |6.976744% ~27 s remaining 
|======                                                                                        |7.188161% ~27 s remaining 
|======                                                                                        |7.399577% ~27 s remaining 
|=======                                                                                       |7.610994% ~26 s remaining 
|=======                                                                                       |7.82241% ~26 s remaining  
|=======                                                                                       |8.033827% ~26 s remaining 
|=======                                                                                       |8.245243% ~26 s remaining 
|=======                                                                                       |8.45666% ~26 s remaining  
|========                                                                                      |8.668076% ~26 s remaining 
|========                                                                                      |8.879493% ~26 s remaining 
|========                                                                                      |9.090909% ~25 s remaining 
|========                                                                                      |9.302326% ~25 s remaining 
|========                                                                                      |9.513742% ~25 s remaining 
|=========                                                                                     |9.725159% ~25 s remaining 
|=========                                                                                     |9.936575% ~25 s remaining 
|=========                                                                                     |10.14799% ~25 s remaining 
|=========                                                                                     |10.35941% ~25 s remaining 
|=========                                                                                     |10.57082% ~25 s remaining 
|==========                                                                                    |10.78224% ~25 s remaining 
|==========                                                                                    |10.99366% ~24 s remaining 
|==========                                                                                    |11.20507% ~24 s remaining 
|==========                                                                                    |11.41649% ~24 s remaining 
|==========                                                                                    |11.62791% ~24 s remaining 
|===========                                                                                   |11.83932% ~24 s remaining 
|===========                                                                                   |12.05074% ~24 s remaining 
|===========                                                                                   |12.26216% ~24 s remaining 
|===========                                                                                   |12.47357% ~24 s remaining 
|===========                                                                                   |12.68499% ~24 s remaining 
|============                                                                                  |12.89641% ~24 s remaining 
|============                                                                                  |13.10782% ~24 s remaining 
|============                                                                                  |13.31924% ~24 s remaining 
|============                                                                                  |13.53066% ~24 s remaining 
|============                                                                                  |13.74207% ~24 s remaining 
|=============                                                                                 |13.95349% ~24 s remaining 
|=============                                                                                 |14.1649% ~24 s remaining  
|=============                                                                                 |14.37632% ~23 s remaining 
|=============                                                                                 |14.58774% ~23 s remaining 
|=============                                                                                 |14.79915% ~23 s remaining 
|==============                                                                                |15.01057% ~23 s remaining 
|==============                                                                                |15.22199% ~23 s remaining 
|==============                                                                                |15.4334% ~23 s remaining  
|==============                                                                                |15.64482% ~23 s remaining 
|==============                                                                                |15.85624% ~23 s remaining 
|===============                                                                               |16.06765% ~23 s remaining 
|===============                                                                               |16.27907% ~23 s remaining 
|===============                                                                               |16.49049% ~23 s remaining 
|===============                                                                               |16.7019% ~23 s remaining  
|===============                                                                               |16.91332% ~23 s remaining 
|================                                                                              |17.12474% ~22 s remaining 
|================                                                                              |17.33615% ~22 s remaining 
|================                                                                              |17.54757% ~22 s remaining 
|================                                                                              |17.75899% ~22 s remaining 
|================                                                                              |17.9704% ~22 s remaining  
|=================                                                                             |18.18182% ~22 s remaining 
|=================                                                                             |18.39323% ~22 s remaining 
|=================                                                                             |18.60465% ~22 s remaining 
|=================                                                                             |18.81607% ~22 s remaining 
|=================                                                                             |19.02748% ~22 s remaining 
|==================                                                                            |19.2389% ~22 s remaining  
|==================                                                                            |19.45032% ~22 s remaining 
|==================                                                                            |19.66173% ~22 s remaining 
|==================                                                                            |19.87315% ~22 s remaining 
|==================                                                                            |20.08457% ~22 s remaining 
|===================                                                                           |20.29598% ~22 s remaining 
|===================                                                                           |20.5074% ~22 s remaining  
|===================                                                                           |20.71882% ~22 s remaining 
|===================                                                                           |20.93023% ~21 s remaining 
|===================                                                                           |21.14165% ~21 s remaining 
|====================                                                                          |21.35307% ~21 s remaining 
|====================                                                                          |21.56448% ~21 s remaining 
|====================                                                                          |21.7759% ~21 s remaining  
|====================                                                                          |21.98732% ~21 s remaining 
|====================                                                                          |22.19873% ~21 s remaining 
|=====================                                                                         |22.41015% ~21 s remaining 
|=====================                                                                         |22.62156% ~21 s remaining 
|=====================                                                                         |22.83298% ~21 s remaining 
|=====================                                                                         |23.0444% ~21 s remaining  
|=====================                                                                         |23.25581% ~21 s remaining 
|======================                                                                        |23.46723% ~21 s remaining 
|======================                                                                        |23.67865% ~21 s remaining 
|======================                                                                        |23.89006% ~21 s remaining 
|======================                                                                        |24.10148% ~21 s remaining 
|======================                                                                        |24.3129% ~21 s remaining  
|=======================                                                                       |24.52431% ~21 s remaining 
|=======================                                                                       |24.73573% ~21 s remaining 
|=======================                                                                       |24.94715% ~21 s remaining 
|=======================                                                                       |25.15856% ~21 s remaining 
|=======================                                                                       |25.36998% ~21 s remaining 
|========================                                                                      |25.5814% ~21 s remaining  
|========================                                                                      |25.79281% ~20 s remaining 
|========================                                                                      |26.00423% ~20 s remaining 
|========================                                                                      |26.21564% ~20 s remaining 
|========================                                                                      |26.42706% ~20 s remaining 
|=========================                                                                     |26.63848% ~20 s remaining 
|=========================                                                                     |26.84989% ~20 s remaining 
|=========================                                                                     |27.06131% ~20 s remaining 
|=========================                                                                     |27.27273% ~20 s remaining 
|=========================                                                                     |27.48414% ~20 s remaining 
|==========================                                                                    |27.69556% ~20 s remaining 
|==========================                                                                    |27.90698% ~20 s remaining 
|==========================                                                                    |28.11839% ~20 s remaining 
|==========================                                                                    |28.32981% ~20 s remaining 
|==========================                                                                    |28.54123% ~20 s remaining 
|===========================                                                                   |28.75264% ~19 s remaining 
|===========================                                                                   |28.96406% ~19 s remaining 
|===========================                                                                   |29.17548% ~19 s remaining 
|===========================                                                                   |29.38689% ~19 s remaining 
|===========================                                                                   |29.59831% ~19 s remaining 
|============================                                                                  |29.80973% ~19 s remaining 
|============================                                                                  |30.02114% ~19 s remaining 
|============================                                                                  |30.23256% ~19 s remaining 
|============================                                                                  |30.44397% ~19 s remaining 
|============================                                                                  |30.65539% ~19 s remaining 
|=============================                                                                 |30.86681% ~19 s remaining 
|=============================                                                                 |31.07822% ~19 s remaining 
|=============================                                                                 |31.28964% ~19 s remaining 
|=============================                                                                 |31.50106% ~19 s remaining 
|=============================                                                                 |31.71247% ~19 s remaining 
|==============================                                                                |31.92389% ~19 s remaining 
|==============================                                                                |32.13531% ~19 s remaining 
|==============================                                                                |32.34672% ~18 s remaining 
|==============================                                                                |32.55814% ~18 s remaining 
|==============================                                                                |32.76956% ~18 s remaining 
|===============================                                                               |32.98097% ~18 s remaining 
|===============================                                                               |33.19239% ~18 s remaining 
|===============================                                                               |33.40381% ~18 s remaining 
|===============================                                                               |33.61522% ~18 s remaining 
|===============================                                                               |33.82664% ~18 s remaining 
|===============================                                                               |34.03805% ~18 s remaining 
|================================                                                              |34.24947% ~18 s remaining 
|================================                                                              |34.46089% ~18 s remaining 
|================================                                                              |34.6723% ~18 s remaining  
|================================                                                              |34.88372% ~18 s remaining 
|================================                                                              |35.09514% ~18 s remaining 
|=================================                                                             |35.30655% ~18 s remaining 
|=================================                                                             |35.51797% ~18 s remaining 
|=================================                                                             |35.72939% ~18 s remaining 
|=================================                                                             |35.9408% ~18 s remaining  
|=================================                                                             |36.15222% ~17 s remaining 
|==================================                                                            |36.36364% ~17 s remaining 
|==================================                                                            |36.57505% ~17 s remaining 
|==================================                                                            |36.78647% ~17 s remaining 
|==================================                                                            |36.99789% ~17 s remaining 
|==================================                                                            |37.2093% ~17 s remaining  
|===================================                                                           |37.42072% ~17 s remaining 
|===================================                                                           |37.63214% ~17 s remaining 
|===================================                                                           |37.84355% ~17 s remaining 
|===================================                                                           |38.05497% ~17 s remaining 
|===================================                                                           |38.26638% ~17 s remaining 
|====================================                                                          |38.4778% ~17 s remaining  
|====================================                                                          |38.68922% ~17 s remaining 
|====================================                                                          |38.90063% ~17 s remaining 
|====================================                                                          |39.11205% ~17 s remaining 
|====================================                                                          |39.32347% ~17 s remaining 
|=====================================                                                         |39.53488% ~17 s remaining 
|=====================================                                                         |39.7463% ~17 s remaining  
|=====================================                                                         |39.95772% ~17 s remaining 
|=====================================                                                         |40.16913% ~16 s remaining 
|=====================================                                                         |40.38055% ~16 s remaining 
|======================================                                                        |40.59197% ~16 s remaining 
|======================================                                                        |40.80338% ~16 s remaining 
|======================================                                                        |41.0148% ~16 s remaining  
|======================================                                                        |41.22622% ~16 s remaining 
|======================================                                                        |41.43763% ~16 s remaining 
|=======================================                                                       |41.64905% ~17 s remaining 
|=======================================                                                       |41.86047% ~17 s remaining 
|=======================================                                                       |42.07188% ~17 s remaining 
|=======================================                                                       |42.2833% ~17 s remaining  
|=======================================                                                       |42.49471% ~16 s remaining 
|========================================                                                      |42.70613% ~16 s remaining 
|========================================                                                      |42.91755% ~16 s remaining 
|========================================                                                      |43.12896% ~16 s remaining 
|========================================                                                      |43.34038% ~16 s remaining 
|========================================                                                      |43.5518% ~16 s remaining  
|=========================================                                                     |43.76321% ~16 s remaining 
|=========================================                                                     |43.97463% ~16 s remaining 
|=========================================                                                     |44.18605% ~16 s remaining 
|=========================================                                                     |44.39746% ~16 s remaining 
|=========================================                                                     |44.60888% ~16 s remaining 
|==========================================                                                    |44.8203% ~16 s remaining  
|==========================================                                                    |45.03171% ~16 s remaining 
|==========================================                                                    |45.24313% ~16 s remaining 
|==========================================                                                    |45.45455% ~16 s remaining 
|==========================================                                                    |45.66596% ~16 s remaining 
|===========================================                                                   |45.87738% ~15 s remaining 
|===========================================                                                   |46.08879% ~15 s remaining 
|===========================================                                                   |46.30021% ~15 s remaining 
|===========================================                                                   |46.51163% ~15 s remaining 
|===========================================                                                   |46.72304% ~15 s remaining 
|============================================                                                  |46.93446% ~15 s remaining 
|============================================                                                  |47.14588% ~15 s remaining 
|============================================                                                  |47.35729% ~15 s remaining 
|============================================                                                  |47.56871% ~15 s remaining 
|============================================                                                  |47.78013% ~15 s remaining 
|=============================================                                                 |47.99154% ~15 s remaining 
|=============================================                                                 |48.20296% ~15 s remaining 
|=============================================                                                 |48.41438% ~15 s remaining 
|=============================================                                                 |48.62579% ~15 s remaining 
|=============================================                                                 |48.83721% ~15 s remaining 
|==============================================                                                |49.04863% ~15 s remaining 
|==============================================                                                |49.26004% ~15 s remaining 
|==============================================                                                |49.47146% ~15 s remaining 
|==============================================                                                |49.68288% ~14 s remaining 
|==============================================                                                |49.89429% ~14 s remaining 
|===============================================                                               |50.10571% ~14 s remaining 
|===============================================                                               |50.31712% ~14 s remaining 
|===============================================                                               |50.52854% ~14 s remaining 
|===============================================                                               |50.73996% ~14 s remaining 
|===============================================                                               |50.95137% ~14 s remaining 
|================================================                                              |51.16279% ~14 s remaining 
|================================================                                              |51.37421% ~14 s remaining 
|================================================                                              |51.58562% ~14 s remaining 
|================================================                                              |51.79704% ~14 s remaining 
|================================================                                              |52.00846% ~14 s remaining 
|=================================================                                             |52.21987% ~14 s remaining 
|=================================================                                             |52.43129% ~14 s remaining 
|=================================================                                             |52.64271% ~14 s remaining 
|=================================================                                             |52.85412% ~14 s remaining 
|=================================================                                             |53.06554% ~14 s remaining 
|==================================================                                            |53.27696% ~13 s remaining 
|==================================================                                            |53.48837% ~13 s remaining 
|==================================================                                            |53.69979% ~13 s remaining 
|==================================================                                            |53.91121% ~13 s remaining 
|==================================================                                            |54.12262% ~13 s remaining 
|===================================================                                           |54.33404% ~13 s remaining 
|===================================================                                           |54.54545% ~13 s remaining 
|===================================================                                           |54.75687% ~13 s remaining 
|===================================================                                           |54.96829% ~13 s remaining 
|===================================================                                           |55.1797% ~13 s remaining  
|====================================================                                          |55.39112% ~13 s remaining 
|====================================================                                          |55.60254% ~13 s remaining 
|====================================================                                          |55.81395% ~13 s remaining 
|====================================================                                          |56.02537% ~13 s remaining 
|====================================================                                          |56.23679% ~13 s remaining 
|=====================================================                                         |56.4482% ~13 s remaining  
|=====================================================                                         |56.65962% ~13 s remaining 
|=====================================================                                         |56.87104% ~12 s remaining 
|=====================================================                                         |57.08245% ~12 s remaining 
|=====================================================                                         |57.29387% ~12 s remaining 
|======================================================                                        |57.50529% ~12 s remaining 
|======================================================                                        |57.7167% ~12 s remaining  
|======================================================                                        |57.92812% ~12 s remaining 
|======================================================                                        |58.13953% ~12 s remaining 
|======================================================                                        |58.35095% ~12 s remaining 
|=======================================================                                       |58.56237% ~12 s remaining 
|=======================================================                                       |58.77378% ~12 s remaining 
|=======================================================                                       |58.9852% ~12 s remaining  
|=======================================================                                       |59.19662% ~12 s remaining 
|=======================================================                                       |59.40803% ~12 s remaining 
|========================================================                                      |59.61945% ~12 s remaining 
|========================================================                                      |59.83087% ~12 s remaining 
|========================================================                                      |60.04228% ~12 s remaining 
|========================================================                                      |60.2537% ~12 s remaining  
|========================================================                                      |60.46512% ~11 s remaining 
|=========================================================                                     |60.67653% ~11 s remaining 
|=========================================================                                     |60.88795% ~11 s remaining 
|=========================================================                                     |61.09937% ~11 s remaining 
|=========================================================                                     |61.31078% ~11 s remaining 
|=========================================================                                     |61.5222% ~11 s remaining  
|==========================================================                                    |61.73362% ~11 s remaining 
|==========================================================                                    |61.94503% ~11 s remaining 
|==========================================================                                    |62.15645% ~11 s remaining 
|==========================================================                                    |62.36786% ~11 s remaining 
|==========================================================                                    |62.57928% ~11 s remaining 
|===========================================================                                   |62.7907% ~11 s remaining  
|===========================================================                                   |63.00211% ~11 s remaining 
|===========================================================                                   |63.21353% ~11 s remaining 
|===========================================================                                   |63.42495% ~11 s remaining 
|===========================================================                                   |63.63636% ~11 s remaining 
|============================================================                                  |63.84778% ~10 s remaining 
|============================================================                                  |64.0592% ~10 s remaining  
|============================================================                                  |64.27061% ~10 s remaining 
|============================================================                                  |64.48203% ~10 s remaining 
|============================================================                                  |64.69345% ~10 s remaining 
|=============================================================                                 |64.90486% ~10 s remaining 
|=============================================================                                 |65.11628% ~10 s remaining 
|=============================================================                                 |65.3277% ~10 s remaining  
|=============================================================                                 |65.53911% ~10 s remaining 
|=============================================================                                 |65.75053% ~10 s remaining 
|==============================================================                                |65.96195% ~10 s remaining 
|==============================================================                                |66.17336% ~10 s remaining 
|==============================================================                                |66.38478% ~10 s remaining 
|==============================================================                                |66.59619% ~10 s remaining 
|==============================================================                                |66.80761% ~10 s remaining 
|==============================================================                                |67.01903% ~10 s remaining 
|===============================================================                               |67.23044% ~10 s remaining 
|===============================================================                               |67.44186% ~9 s remaining  
|===============================================================                               |67.65328% ~9 s remaining  
|===============================================================                               |67.86469% ~9 s remaining  
|===============================================================                               |68.07611% ~9 s remaining  
|================================================================                              |68.28753% ~9 s remaining  
|================================================================                              |68.49894% ~9 s remaining  
|================================================================                              |68.71036% ~9 s remaining  
|================================================================                              |68.92178% ~9 s remaining  
|================================================================                              |69.13319% ~9 s remaining  
|=================================================================                             |69.34461% ~9 s remaining  
|=================================================================                             |69.55603% ~9 s remaining  
|=================================================================                             |69.76744% ~9 s remaining  
|=================================================================                             |69.97886% ~9 s remaining  
|=================================================================                             |70.19027% ~9 s remaining  
|==================================================================                            |70.40169% ~9 s remaining  
|==================================================================                            |70.61311% ~9 s remaining  
|==================================================================                            |70.82452% ~9 s remaining  
|==================================================================                            |71.03594% ~8 s remaining  
|==================================================================                            |71.24736% ~8 s remaining  
|===================================================================                           |71.45877% ~8 s remaining  
|===================================================================                           |71.67019% ~8 s remaining  
|===================================================================                           |71.88161% ~8 s remaining  
|===================================================================                           |72.09302% ~8 s remaining  
|===================================================================                           |72.30444% ~8 s remaining  
|====================================================================                          |72.51586% ~8 s remaining  
|====================================================================                          |72.72727% ~8 s remaining  
|====================================================================                          |72.93869% ~8 s remaining  
|====================================================================                          |73.15011% ~8 s remaining  
|====================================================================                          |73.36152% ~8 s remaining  
|=====================================================================                         |73.57294% ~8 s remaining  
|=====================================================================                         |73.78436% ~8 s remaining  
|=====================================================================                         |73.99577% ~8 s remaining  
|=====================================================================                         |74.20719% ~8 s remaining  
|=====================================================================                         |74.4186% ~7 s remaining   
|======================================================================                        |74.63002% ~7 s remaining  
|======================================================================                        |74.84144% ~7 s remaining  
|======================================================================                        |75.05285% ~7 s remaining  
|======================================================================                        |75.26427% ~7 s remaining  
|======================================================================                        |75.47569% ~7 s remaining  
|=======================================================================                       |75.6871% ~7 s remaining   
|=======================================================================                       |75.89852% ~7 s remaining  
|=======================================================================                       |76.10994% ~7 s remaining  
|=======================================================================                       |76.32135% ~7 s remaining  
|=======================================================================                       |76.53277% ~7 s remaining  
|========================================================================                      |76.74419% ~7 s remaining  
|========================================================================                      |76.9556% ~7 s remaining   
|========================================================================                      |77.16702% ~7 s remaining  
|========================================================================                      |77.37844% ~7 s remaining  
|========================================================================                      |77.58985% ~7 s remaining  
|=========================================================================                     |77.80127% ~7 s remaining  
|=========================================================================                     |78.01268% ~6 s remaining  
|=========================================================================                     |78.2241% ~6 s remaining   
|=========================================================================                     |78.43552% ~6 s remaining  
|=========================================================================                     |78.64693% ~6 s remaining  
|==========================================================================                    |78.85835% ~6 s remaining  
|==========================================================================                    |79.06977% ~6 s remaining  
|==========================================================================                    |79.28118% ~6 s remaining  
|==========================================================================                    |79.4926% ~6 s remaining   
|==========================================================================                    |79.70402% ~6 s remaining  
|===========================================================================                   |79.91543% ~6 s remaining  
|===========================================================================                   |80.12685% ~6 s remaining  
|===========================================================================                   |80.33827% ~6 s remaining  
|===========================================================================                   |80.54968% ~6 s remaining  
|===========================================================================                   |80.7611% ~6 s remaining   
|============================================================================                  |80.97252% ~6 s remaining  
|============================================================================                  |81.18393% ~6 s remaining  
|============================================================================                  |81.39535% ~5 s remaining  
|============================================================================                  |81.60677% ~5 s remaining  
|============================================================================                  |81.81818% ~5 s remaining  
|=============================================================================                 |82.0296% ~5 s remaining   
|=============================================================================                 |82.24101% ~5 s remaining  
|=============================================================================                 |82.45243% ~5 s remaining  
|=============================================================================                 |82.66385% ~5 s remaining  
|=============================================================================                 |82.87526% ~5 s remaining  
|==============================================================================                |83.08668% ~5 s remaining  
|==============================================================================                |83.2981% ~5 s remaining   
|==============================================================================                |83.50951% ~5 s remaining  
|==============================================================================                |83.72093% ~5 s remaining  
|==============================================================================                |83.93235% ~5 s remaining  
|===============================================================================               |84.14376% ~5 s remaining  
|===============================================================================               |84.35518% ~5 s remaining  
|===============================================================================               |84.5666% ~5 s remaining   
|===============================================================================               |84.77801% ~4 s remaining  
|===============================================================================               |84.98943% ~4 s remaining  
|================================================================================              |85.20085% ~4 s remaining  
|================================================================================              |85.41226% ~4 s remaining  
|================================================================================              |85.62368% ~4 s remaining  
|================================================================================              |85.8351% ~4 s remaining   
|================================================================================              |86.04651% ~4 s remaining  
|=================================================================================             |86.25793% ~4 s remaining  
|=================================================================================             |86.46934% ~4 s remaining  
|=================================================================================             |86.68076% ~4 s remaining  
|=================================================================================             |86.89218% ~4 s remaining  
|=================================================================================             |87.10359% ~4 s remaining  
|==================================================================================            |87.31501% ~4 s remaining  
|==================================================================================            |87.52643% ~4 s remaining  
|==================================================================================            |87.73784% ~4 s remaining  
|==================================================================================            |87.94926% ~4 s remaining  
|==================================================================================            |88.16068% ~3 s remaining  
|===================================================================================           |88.37209% ~3 s remaining  
|===================================================================================           |88.58351% ~3 s remaining  
|===================================================================================           |88.79493% ~3 s remaining  
|===================================================================================           |89.00634% ~3 s remaining  
|===================================================================================           |89.21776% ~3 s remaining  
|====================================================================================          |89.42918% ~3 s remaining  
|====================================================================================          |89.64059% ~3 s remaining  
|====================================================================================          |89.85201% ~3 s remaining  
|====================================================================================          |90.06342% ~3 s remaining  
|====================================================================================          |90.27484% ~3 s remaining  
|=====================================================================================         |90.48626% ~3 s remaining  
|=====================================================================================         |90.69767% ~3 s remaining  
|=====================================================================================         |90.90909% ~3 s remaining  
|=====================================================================================         |91.12051% ~3 s remaining  
|=====================================================================================         |91.33192% ~3 s remaining  
|======================================================================================        |91.54334% ~2 s remaining  
|======================================================================================        |91.75476% ~2 s remaining  
|======================================================================================        |91.96617% ~2 s remaining  
|======================================================================================        |92.17759% ~2 s remaining  
|======================================================================================        |92.38901% ~2 s remaining  
|=======================================================================================       |92.60042% ~2 s remaining  
|=======================================================================================       |92.81184% ~2 s remaining  
|=======================================================================================       |93.02326% ~2 s remaining  
|=======================================================================================       |93.23467% ~2 s remaining  
|=======================================================================================       |93.44609% ~2 s remaining  
|========================================================================================      |93.65751% ~2 s remaining  
|========================================================================================      |93.86892% ~2 s remaining  
|========================================================================================      |94.08034% ~2 s remaining  
|========================================================================================      |94.29175% ~2 s remaining  
|========================================================================================      |94.50317% ~2 s remaining  
|=========================================================================================     |94.71459% ~2 s remaining  
|=========================================================================================     |94.926% ~1 s remaining    
|=========================================================================================     |95.13742% ~1 s remaining  
|=========================================================================================     |95.34884% ~1 s remaining  
|=========================================================================================     |95.56025% ~1 s remaining  
|==========================================================================================    |95.77167% ~1 s remaining  
|==========================================================================================    |95.98309% ~1 s remaining  
|==========================================================================================    |96.1945% ~1 s remaining   
|==========================================================================================    |96.40592% ~1 s remaining  
|==========================================================================================    |96.61734% ~1 s remaining  
|===========================================================================================   |96.82875% ~1 s remaining  
|===========================================================================================   |97.04017% ~1 s remaining  
|===========================================================================================   |97.25159% ~1 s remaining  
|===========================================================================================   |97.463% ~1 s remaining    
|===========================================================================================   |97.67442% ~1 s remaining  
|============================================================================================  |97.88584% ~1 s remaining  
|============================================================================================  |98.09725% ~1 s remaining  
|============================================================================================  |98.30867% ~0 s remaining  
|============================================================================================  |98.52008% ~0 s remaining  
|============================================================================================  |98.7315% ~0 s remaining   
|============================================================================================= |98.94292% ~0 s remaining  
|============================================================================================= |99.15433% ~0 s remaining  
|============================================================================================= |99.36575% ~0 s remaining  
|============================================================================================= |99.57717% ~0 s remaining  
|============================================================================================= |99.78858% ~0 s remaining  
|==============================================================================================|100% ~0 s remaining       
|==============================================================================================|100%                      Completed after 30 s 
Starting to add information to samples
 => Add clinical information to samples
 => Adding TCGA molecular information from marker papers
 => Information will have prefix 'paper_' 
skcm subtype information from:doi:10.1016/j.cell.2015.05.044
Available assays in SummarizedExperiment : 
  => unstranded
  => stranded_first
  => stranded_second
  => tpm_unstrand
  => fpkm_unstrand
  => fpkm_uq_unstrand
#set up maf object 
maf_object <- read.csv("/Users/mishafaruki/Desktop/QBIO490/qbio_490_mishafaruki/analysis_data/skcm_clinical_data.csv")
colnames(clinical)[ colnames(clinical) == "bcr_patient_barcode" ] <- "Tumor_Sample_Barcode"
write.csv(clinical, "/Users/mishafaruki/Desktop/QBIO490/qbio_490_mishafaruki/analysis_data/skcm_clinical_data.csv", row.names = FALSE)

maf_query <- GDCquery(
    project = "TCGA-SKCM", 
    data.category = "Simple Nucleotide Variation", 
    access = "open", # we only have access to somatic mutations which are open access
    data.type = "Masked Somatic Mutation", 
    workflow.type = "Aliquot Ensemble Somatic Variant Merging and Masking")
--------------------------------------
o GDCquery: Searching in GDC database
--------------------------------------
Genome of reference: hg38
--------------------------------------------
oo Accessing GDC. This might take a while...
--------------------------------------------
ooo Project: TCGA-SKCM
--------------------
oo Filtering results
--------------------
ooo By access
ooo By data.type
ooo By workflow.type
----------------
oo Checking data
----------------
ooo Checking if there are duplicated cases
ooo Checking if there are results for the query
-------------------
o Preparing output
-------------------
# GDCdownload(maf_query) # you shouldn't have to redownload any data!

maf <- GDCprepare(maf_query) #as long as it runs, ignore any errors
Warning: One or more parsing issues, call `problems()` on your data frame for details, e.g.:
  dat <- vroom(...)
  problems(dat)
maf_object <- read.maf(maf = maf, 
                       clinicalData = rna_clinical,
                       isTCGA = TRUE)
-Validating
-Silent variants: 126725 
-Summarizing
--Possible FLAGS among top ten genes:
  TTN
  MUC16
-Processing clinical data
--Annotation missing for below samples in MAF:
  TCGA-GN-A269
-Finished in 16.7s elapsed (7.215s cpu) 
#hold clinical data of maf object 
maf_clinical = maf_object@clinical.data
maf_clinical
#Extract data in definition column that is metastatic and put it into meta 
meta <- maf_clinical[maf_clinical$definition == "Metastatic", ]
#Extract values from Tumor_Sample_Barcode of meta too and store it in there
meta <- meta$Tumor_Sample_Barcode

nonmeta <- maf_clinical[maf_clinical$definition == "Primary solid Tumor", ]
nonmeta <- nonmeta$Tumor_Sample_Barcode
# Subsetting based on clinical variables, meta and nonmeta 
meta_maf <- subsetMaf(maf = maf_object, tsb = meta)
--Possible FLAGS among top ten genes:
  TTN
  MUC16
-Processing clinical data
nonmeta_maf <- subsetMaf(maf = maf_object, tsb = nonmeta)
--Possible FLAGS among top ten genes:
  TTN
  MUC16
-Processing clinical data
coOncoplot(m1 = meta_maf,
           m2 = nonmeta_maf,
           m1Name = "Metastatic",
           m2Name = "Non-metastatic",
           borderCol = NA)

  1. Mutation differences for specific gene of interest (one of most mutated genes)(Co-lollipop plot)
#lollipop chart 
lollipopPlot2(m1 = meta_maf,
              m2 = nonmeta_maf,
              m1_name = "Metastatic", #why can't this be m1Name? 
              m2_name = "Non-metastatic",
              gene="TTN")
Gene: TTN
Assuming protein change information are stored under column HGVSp_Short. Use argument AACol to override if necessary.
7 transcripts available. Use arguments refSeqID or proteinID to manually specify tx name.
Using longer transcript NM_001267550 for now.
Assuming protein change information are stored under column HGVSp_Short. Use argument AACol to override if necessary.
7 transcripts available. Use arguments refSeqID or proteinID to manually specify tx name.
Using longer transcript NM_001267550 for now.

lollipopPlot(maf=meta_maf, 
             gene="TTN")
7 transcripts available. Use arguments refSeqID or proteinID to manually specify tx name.
Using longer transcript NM_001267550 for now.
Assuming protein change information are stored under column HGVSp_Short. Use argument AACol to override if necessary.

lollipopPlot(maf=nonmeta_maf, 
             gene="TTN")
7 transcripts available. Use arguments refSeqID or proteinID to manually specify tx name.
Using longer transcript NM_001267550 for now.
Assuming protein change information are stored under column HGVSp_Short. Use argument AACol to override if necessary.

  1. Coocurrence or mutual exclusion of common gene mutations: one for metastatic patients, one for non-metastatic patients (2 somatic interation plots)
somatic_interaction_metastatic <- somaticInteractions(maf = meta_maf, top = 20)

somatic_interaction_nonmetastatic <- somaticInteractions(maf = nonmeta_maf, top = 20)

  1. Differential expression between non-metastatic and metastatic patients controlling for treatment effects, race, gender, and vital status (DESeq2 + Volcano plot)
  1. Treatments must include radiation, chemotherapy, immunotherapy, molecular therapy, vaccine
  2. Treatments must include radiation, chemotherapy, immunotherapy, molecular therapy, vaccine
#import packages 
library(SummarizedExperiment)
BiocManager::install("DESeq2")
'getOption("repos")' replaces Bioconductor standard repositories, see 'help("repositories", package = "BiocManager")' for
details.
Replacement repositories:
    CRAN: https://cran.rstudio.com/
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.2 (2023-10-31)
Warning: package(s) not installed when version(s) same as or greater than current; use `force = TRUE` to re-install: 'DESeq2'Old packages: 'Biostrings', 'ggsci', 'zlibbioc'
Update all/some/none? [a/s/n]: 
a
Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/experiment/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/experiment/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/workflows/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/workflows/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/books/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/books/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'trying URL 'https://bioconductor.org/packages/3.18/bioc/bin/macosx/big-sur-arm64/contrib/4.3/Biostrings_2.70.2.tgz'
Content type 'application/x-gzip' length 14457225 bytes (13.8 MB)
==================================================
downloaded 13.8 MB

trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.3/ggsci_3.0.1.tgz'
Content type 'application/x-gzip' length 2349367 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

trying URL 'https://bioconductor.org/packages/3.18/bioc/bin/macosx/big-sur-arm64/contrib/4.3/zlibbioc_1.48.0.tgz'
Content type 'application/x-gzip' length 13991 bytes (13 KB)
==================================================
downloaded 13 KB

The downloaded binary packages are in
    /var/folders/td/fmyn6z116gxg422m8gll06th0000gn/T//RtmpQX4yvI/downloaded_packages
library(DESeq2)
library(ggplot2)
library(ggrepel)
BiocManager::install("EnhancedVolcano")
'getOption("repos")' replaces Bioconductor standard repositories, see 'help("repositories", package = "BiocManager")' for
details.
Replacement repositories:
    CRAN: https://cran.rstudio.com/
Bioconductor version 3.18 (BiocManager 1.30.22), R 4.3.2 (2023-10-31)
Warning: package(s) not installed when version(s) same as or greater than current; use `force = TRUE` to re-install:
  'EnhancedVolcano'Old packages: 'Biostrings', 'ggsci', 'zlibbioc'
Update all/some/none? [a/s/n]: 
a
Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/annotation/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/experiment/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/data/experiment/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/workflows/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/workflows/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/books/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.rds': HTTP status was '404 Not Found'Warning: downloaded length 0 != reported length 0Warning: cannot open URL 'https://bioconductor.org/packages/3.18/books/bin/macosx/big-sur-arm64/contrib/4.3/PACKAGES.gz': HTTP status was '404 Not Found'trying URL 'https://bioconductor.org/packages/3.18/bioc/bin/macosx/big-sur-arm64/contrib/4.3/Biostrings_2.70.2.tgz'
Content type 'application/x-gzip' length 14457225 bytes (13.8 MB)
==================================================
downloaded 13.8 MB

trying URL 'https://cran.rstudio.com/bin/macosx/big-sur-arm64/contrib/4.3/ggsci_3.0.1.tgz'
Content type 'application/x-gzip' length 2349367 bytes (2.2 MB)
==================================================
downloaded 2.2 MB

trying URL 'https://bioconductor.org/packages/3.18/bioc/bin/macosx/big-sur-arm64/contrib/4.3/zlibbioc_1.48.0.tgz'
Content type 'application/x-gzip' length 13991 bytes (13 KB)
==================================================
downloaded 13 KB

The downloaded binary packages are in
    /var/folders/td/fmyn6z116gxg422m8gll06th0000gn/T//RtmpQX4yvI/downloaded_packages
library(EnhancedVolcano)
all_chemo <- drug[drug$pharmaceutical_therapy_type == 'Chemotherapy',]
rna_clinical$chemotherapy <- ifelse(rna_clinical$patient %in% all_chemo$bcr_patient_barcode, 1, 0)

# immunotherapy
all_immuno <- drug[drug$pharmaceutical_therapy_type == 'Immunotherapy',]
rna_clinical$immunotherapy <- ifelse(rna_clinical$patient %in% all_immuno$bcr_patient_barcode, 1, 0)

# radiation
all_radio <- drug[drug$pharmaceutical_therapy_type == 'Ancillary',]
rna_clinical$radiation <- ifelse(rna_clinical$patient %in% all_radio$bcr_patient_barcode, 1, 0)

# molecular
all_molec <- drug[drug$pharmaceutical_therapy_type == 'Targeted Molecular therapy',]
rna_clinical$molecular <- ifelse(rna_clinical$patient %in% all_molec$bcr_patient_barcode, 1, 0)

# vaccine
all_vaccine <- drug[drug$pharmaceutical_therapy_type == 'Vaccine',]
rna_clinical$vaccine <- ifelse(rna_clinical$patient %in% all_vaccine$bcr_patient_barcode, 1, 0)




# Factorize all columns
rna_clinical$chemotherapy <- factor(rna_clinical$chemotherapy)
rna_clinical$immunotherapy <- factor(rna_clinical$immunotherapy)
rna_clinical$radiation <- factor(rna_clinical$radiation)
rna_clinical$molecular <- factor(rna_clinical$molecular)
rna_clinical$vaccine <- factor(rna_clinical$vaccine)

rna_clinical$race <- factor(rna_clinical$race)
rna_clinical$gender <- factor(rna_clinical$gender)
rna_clinical$vital_status <- factor(rna_clinical$vital_status)

# find counts of rna_se
countData <- assay(rna_se)

# create the DESeqDataSet
dds <- DESeqDataSetFromMatrix(countData = countData,
                              colData = rna_clinical,
                              design = ~ chemotherapy + immunotherapy + radiation + molecular + vaccine + race + gender + vital_status)
  Note: levels of factors in the design contain characters other than
  letters, numbers, '_' and '.'. It is recommended (but not required) to use
  only letters, numbers, and delimiters '_' or '.', as these are safe characters
  for column names in R. [This is a message, not a warning or an error]
# Filter out genes with low expression
dds <- dds[rowSums(counts(dds)) > 20, ]

# Run DESeq
dds <- DESeq(dds)
estimating size factors
  Note: levels of factors in the design contain characters other than
  letters, numbers, '_' and '.'. It is recommended (but not required) to use
  only letters, numbers, and delimiters '_' or '.', as these are safe characters
  for column names in R. [This is a message, not a warning or an error]
estimating dispersions
gene-wise dispersion estimates
mean-dispersion relationship
  Note: levels of factors in the design contain characters other than
  letters, numbers, '_' and '.'. It is recommended (but not required) to use
  only letters, numbers, and delimiters '_' or '.', as these are safe characters
  for column names in R. [This is a message, not a warning or an error]
final dispersion estimates
fitting model and testing
701 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
  Note: levels of factors in the design contain characters other than
  letters, numbers, '_' and '.'. It is recommended (but not required) to use
  only letters, numbers, and delimiters '_' or '.', as these are safe characters
  for column names in R. [This is a message, not a warning or an error]
-- replacing outliers and refitting for 25273 genes
-- DESeq argument 'minReplicatesForReplace' = 7 
-- original counts are preserved in counts(dds)
estimating dispersions
fitting model and testing
566 rows did not converge in beta, labelled in mcols(object)$betaConv. Use larger maxit argument with nbinomWaldTest
  Note: levels of factors in the design contain characters other than
  letters, numbers, '_' and '.'. It is recommended (but not required) to use
  only letters, numbers, and delimiters '_' or '.', as these are safe characters
  for column names in R. [This is a message, not a warning or an error]
# Results with thresholding
res <- results(dds, alpha = 0.05)
res <- res[!is.na(res$padj) & abs(res$log2FoldChange) > 1, ]

# convert to data frame in order to pass to ggplot
res_df <- as.data.frame(res) 

# volcano plot using the data frame
ggplot(res_df, aes(x=log2FoldChange, y=-log10(padj))) + 
  geom_point(aes(color = padj < 0.05)) + 
  scale_color_manual(values = c("TRUE" = "red", "FALSE" = "black")) + 
  theme_minimal() + 
  labs(x = "Log2 Fold Change", y = "-Log10 adjusted p-value", title = "Volcano plot of differential expression")

Add a new chunk by clicking the Insert Chunk button on the toolbar or by pressing Cmd+Option+I.

When you save the notebook, an HTML file containing the code and output will be saved alongside it (click the Preview button or press Cmd+Shift+K to preview the HTML file).

The preview shows you a rendered HTML copy of the contents of the editor. Consequently, unlike Knit, Preview does not run any R code chunks. Instead, the output of the chunk when it was last run in the editor is displayed.

LS0tCnRpdGxlOiAiUiBOb3RlYm9vayIKb3V0cHV0OiBodG1sX25vdGVib29rCi0tLQoKVGhpcyBpcyBhbiBbUiBNYXJrZG93bl0oaHR0cDovL3JtYXJrZG93bi5yc3R1ZGlvLmNvbSkgTm90ZWJvb2suIFdoZW4geW91IGV4ZWN1dGUgY29kZSB3aXRoaW4gdGhlIG5vdGVib29rLCB0aGUgcmVzdWx0cyBhcHBlYXIgYmVuZWF0aCB0aGUgY29kZS4gCgpUcnkgZXhlY3V0aW5nIHRoaXMgY2h1bmsgYnkgY2xpY2tpbmcgdGhlICpSdW4qIGJ1dHRvbiB3aXRoaW4gdGhlIGNodW5rIG9yIGJ5IHBsYWNpbmcgeW91ciBjdXJzb3IgaW5zaWRlIGl0IGFuZCBwcmVzc2luZyAqQ21kK1NoaWZ0K0VudGVyKi4gCgpgYGB7ciBzZXR1cH0KI3NldCB1cCBwYXRoIAogIGtuaXRyOjpvcHRzX2tuaXQkc2V0KHJvb3QuZGlyID0gbm9ybWFsaXplUGF0aCgiL1VzZXJzL21pc2hhZmFydWtpL0Rlc2t0b3AvUUJJTzQ5MC9xYmlvXzQ5MF9taXNoYWZhcnVraS9hbmFseXNpc19kYXRhIikpIApgYGAKCgpgYGB7cn0KI2ltcG9ydCBsaWJyYXJpZXMgCmxpYnJhcnkoQmlvY01hbmFnZXIpCmxpYnJhcnkoVENHQWJpb2xpbmtzKQpsaWJyYXJ5KG1hZnRvb2xzKQoKI2NyZWF0ZSBhIHF1ZXJ5IGJhc2VkIG9uIHRoZSBjbGluaWNhbCBjYXRlZ29yeSBvZiBUQ0dBLVNLQ00gCmNsaW5fcXVlcnkgPC0gR0RDcXVlcnkocHJvamVjdCA9ICJUQ0dBLVNLQ00iLAogIGRhdGEuY2F0ZWdvcnkgPSAiQ2xpbmljYWwiLAogIGRhdGEudHlwZSA9ICJDbGluaWNhbCBTdXBwbGVt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